package com.whg.demo.controller;

import com.whg.demo.biz.StaticUserOne;
import com.whg.demo.biz.StaticUserTwo;
import com.whg.demo.model.JsonData;
import com.whg.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author whg
 * @create 2022/12/15 14:50
 * @description：
 */
@RestController
@RequestMapping("/static")
public class TestStaticController {

    @Autowired
    private StaticUserOne userOne;

    @Autowired
    private StaticUserTwo userTwo;

    @GetMapping("/user")
    public JsonData getUser(@RequestParam("type") String type){
        User user = null;
        if(type.equals("1")){
            user = userOne.getUser();
        }else {
            user = userTwo.getUser();
        }
        return JsonData.buildSuccess(user);
    }
}
